package com.gewu.ordlelist.activity;

import android.content.DialogInterface;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import androidx.appcompat.widget.Toolbar;

import com.gewu.ordlelist.R;
import com.gewu.ordlelist.base.BaseActivity;
import com.gewu.ordlelist.utils.jocUtils;

public class mian2 extends BaseActivity {


    private Toolbar toolbar;
    private android.widget.TextView text;
    private android.widget.EditText name;
    private Button action;

    @Override
    public int FindLayout() {
        return R.layout.activity_mian2;
    }

    @Override
    public Toolbar getToolBar() {
        return toolbar;
    }

    @Override
    public boolean isShowBackToolbar() {
        return true;
    }

    @Override
    public String setToolbarText() {
        return "上传菜单";
    }

    @Override
    public void initview() {
        toolbar = findViewById(R.id.toolbar);
        text = findViewById(R.id.text);
        toolbar.setTitle(setToolbarText());

        action = findViewById(R.id.action);
        name = findViewById(R.id.name);

        action.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (name.getText().toString().isEmpty()){
                    Toast.makeText(mian2.this, "空", Toast.LENGTH_SHORT).show();
                    return;
                }

                jocUtils.showDilog(mian2.this,"提示","您确定要把"+name.getText().toString()+"加入菜单吗？").setPositiveButton("ok", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                        finish();
                    }
                }).setNegativeButton("no", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                }).show();
            }
        });


    }


}